You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JIRA:HDFS-16631. Enable dfs.datanode.lockmanager.trace In Test.
In Jira HDFS-16600. Fix deadlock on DataNode side. We discussed the issue of deadlock, this is a very meaningful discussion, I was reading the log and found the following:
2022-05-27 07:39:47,890 [Listener at localhost/36941] WARN datanode.DataSetLockManager (DataSetLockManager.java:lockLeakCheck(261)) -
not open lock leak check func.
Looking at the code, I found that there is such a parameter:
<property>
<name>dfs.datanode.lockmanager.trace</name>
<value>false</value>
<description>
If this is true, after shut down datanode lock Manager will print all leak
thread that not release by lock Manager. Only used for test or trace dead lock
problem. In produce default set false, because it's have little performance loss.
</description>
</property>
I think this parameter should be added in the test environment, so that if there is a DN deadlock, the cause can be quickly located.
If my understanding is correct, if a thread needs both read locks and write locks, if this parameter is true, relevant thread information can be printed.
DataSetLockManager only print lock trace when invoke DataNode.shutdown() or dataSetLockManager.lockLeakCheck().So I doubt it will work in all UT.
Thanks for the suggestion, I think this parameter can cover scenarios like HDFS-16600, DN shutdown will definitely be called in Junit Test, I personally feel that if there is an error in the junit test of DN and if we suspect a deadlock, we can see this print message.
Ans should we throw Exception ? Most of user will ignore if just print the log.
If a thread obtains a read lock (write lock) and needs to obtain a write lock (read lock), will an exception be thrown directly?
My understanding is that once a deadlock occurs, the code will definitely report an error, and there is no need to throw an exception directly. I personally feel that printing is enough. of course, we can also throw exceptions directly.
@slfan1989 It's a good idea. But I personally feel that it would be nice to thrown exception directly in the test environment when there is a lock leak.
From my side, I do not think enable lock trace only is good idea for tests as @MingXiangLi has mentioned above. The only INFO level log will not help to debug or test. IMO, if there are some cases we would like to cover and need to collect locks information, it is better to add some inject logic. FYI.
From my side, I do not think enable lock trace only is good idea for tests as @MingXiangLi has mentioned above. The only INFO level log will not help to debug or test. IMO, if there are some cases we would like to cover and need to collect locks information, it is better to add some inject logic. FYI.
Thank you very much for your suggestion, I will think about how to collect lock information!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA:HDFS-16631. Enable dfs.datanode.lockmanager.trace In Test.
In Jira HDFS-16600. Fix deadlock on DataNode side. We discussed the issue of deadlock, this is a very meaningful discussion, I was reading the log and found the following:
PR:#4367
Looking at the code, I found that there is such a parameter:
I think this parameter should be added in the test environment, so that if there is a DN deadlock, the cause can be quickly located.
If my understanding is correct, if a thread needs both read locks and write locks, if this parameter is true, relevant thread information can be printed.